$(function () {
    $("#jqGrid").jqGrid({
        url: baseURL + 'module/qywxgzuserinfo/list',
        datatype: "json",
        colModel: [			
			{ label: 'id', name: 'id', index: 'id', width: 150, key: true },
            { label: '头像url', name: 'avatar', index: 'avatar', width: 60 , formatter: function(value, options, row){
                return "<img src=\""+value+"\" style='width: 60px;height: 50px'/>";
            }},
			{ label: '姓名', name: 'name', index: 'name', width: 80 },
			{ label: '省份', name: 'province', index: 'province', width: 80 }, 			
			{ label: '性别', name: 'gender', index: 'gender', width: 50  ,formatter: function(value, options, row){
                return value === "0" ?
                    '<span >女</span>' :
                    '<span >男</span>';
            }},
			{ label: '关注', name: 'subscribeStatus', index: 'subscribe_status', width: 50 ,formatter: function(value, options, row){
                return value === "0" ?
                    '<span class="label label-danger">未关注</span>' :
                    '<span class="label label-success">已关注</span>';
            }},
			{ label: '关注时间', name: 'subscribeTime', index: 'subscribe_time', width: 100 },
            { label: '创建日期', name: 'createDate', index: 'create_date', width: 100 }
        ],
		viewrecords: true,
        height: 385,
        rowNum: 10,
		rowList : [10,50,100],
        rownumbers: true, 
        rownumWidth: 25, 
        autowidth:true,
        multiselect: false,
        pager: "#jqGridPager",
        jsonReader : {
            root: "page.records",
            page: "page.current",
            total: "page.pages",
            records: "page.total"
        },
        prmNames : {
            page:"page", 
            rows:"limit", 
            order: "order"
        }
    });
});

var vm = new Vue({
	el:'#rrapp',
	data:{
		title: null,
		qywxGzuserinfo: {}
	},
	methods: {
		query: function () {
			vm.reload();
		},
		getInfo: function(id){
			$.get(baseURL + "module/qywxgzuserinfo/info/"+id, function(r){
                vm.qywxGzuserinfo = r.qywxGzuserinfo;
            });
		},
		reload: function (event) {
			var page = $("#jqGrid").jqGrid('getGridParam','page');
			$("#jqGrid").jqGrid('setGridParam',{ 
                page:page
            }).trigger("reloadGrid");
		}
	}
});